Skip to content

Query the fragment, host, path, port, and protocol from a URL

Use the url_extract_fragment function to obtain the fragment from a URL. Use the url_extract_host function to obtain the host from a URL. Use the url_extract_path function to obtain the path from a URL. Use the url_extract_port function to obtain the port from a URL. Use the url_extract_protocol function obtain the protocol from a URL.

SQL
* |
select
  url_extract_fragment(
    'https://sls.console.aliyun.com/#/project/dashboard-demo/categoryList'
  ) as fragment,
  url_extract_host(
    'https://sls.console.aliyun.com/#/project/dashboard-demo/categoryList'
  ) as host,
  url_extract_path(
    'https://sls.console.aliyun.com/lognext/project/dashboard-all/logsearch/nginx-demo?accounttraceid=d6241a173f88471c91d3405cda010ff5ghdw'
  ) as path,
  url_extract_port('http://localhost:8080/lognext/profile') as port,
  url_extract_protocol('http://localhost:8080/lognext/profile') as agreement